﻿using System;
using System.Collections.Generic;
using ParserGenerator.Collections;

namespace ParserGenerator.ParserConstruction
{
    [Serializable]
    public sealed class ParserAutomatonStatePredecessors : ReadOnlySet<ParserAutomatonState>
    {
        internal ParserAutomatonStatePredecessors()
            : base(new HashSet<ParserAutomatonState>())
        {
        }

        internal void Add(ParserAutomatonState predecessor)
        {
            if (predecessor == null)
                throw new ArgumentNullException(nameof(predecessor));
            Set.Add(predecessor);
        }
    }
}
